package channelRestfulNotify

import (
	"gitee.com/fierce_wolf/go-fox-edge-common/commEntity"
	"gitee.com/fierce_wolf/go-fox-edge-common/commEnv"
	"gitee.com/fierce_wolf/go-fox-edge-common/commRedisRpc"
)

type RestfulMessageService struct {
}

func CreateChannel(channelName string, channelParam map[string]interface{}) {
	entity := commEntity.Type.ChannelEntity.Instance()
	entity.ChannelType = commEnv.Service.ModelName
	entity.ChannelName = channelName
	if channelParam != nil {
		entity.ChannelParam = channelParam
	}

	commRedisRpc.Manager.Client.Request.PushRequest("", "/channel/entity", "post", entity)
}

func CreateDevice(manufacturer string, deviceType string, deviceName string, channelName string, deviceParam map[string]interface{}) {
	entity := commEntity.Type.DeviceEntity.Instance()
	entity.Manufacturer = manufacturer
	entity.DeviceType = deviceType
	entity.DeviceName = deviceName
	entity.ChannelType = commEnv.Service.ModelName
	entity.ChannelName = channelName
	if deviceParam != nil {
		entity.DeviceParam = deviceParam
	}

	commRedisRpc.Manager.Client.Request.PushRequest("", "/device/entity", "post", entity)
}
